/*
 * @Author: Shane
 * @Date: 2022-06-30 10:22:17
 * @LastEditTime: 2022-06-30 10:32:39
 * @LastEditors: Shane
 * @Description:  导航条左边有返回和关闭按钮
 * @FilePath: /app-framework/common_widgets/lib/app_bar/app_bar_close.dart
 */

import 'package:common_widgets/app_bar/app_bar.dart';
import 'package:flutter/material.dart';

class KKAppBarClose extends KKAppBar {
  KKAppBarClose(
    String title,
    BuildContext context, {
    Key? key,
    Function()? onTapBackCallback,
    Function()? onTapCloseCallback,
  }) : super(
          title,
          context,
          key: key,
          leadingWidth: 80,
          leading: Container(
            padding: const EdgeInsets.only(left: 14),
            child: Row(
              children: [
                SizedBox(
                  width: 30,
                  child: IconButton(
                    padding: const EdgeInsets.all(0),
                    onPressed: onTapBackCallback ??
                        () {
                          Navigator.of(context).pop();
                        },
                    icon: const Icon(
                      Icons.arrow_back_ios,
                      color: Color(0xFF909399),
                    ),
                  ),
                ),
                SizedBox(
                  width: 30,
                  child: IconButton(
                    padding: const EdgeInsets.all(0),
                    onPressed: onTapCloseCallback ??
                        () {
                          Navigator.of(context).popUntil(
                              ((route) => route.settings.name == '/'));
                        },
                    icon: const Icon(
                      Icons.close,
                      color: Color(0xFF909399),
                    ),
                  ),
                ),
              ],
            ),
          ),
        );
}
